<?php

// 客户端

$client = stream_socket_client('tcp://0.0.0.0:8484', $errno, $errstr);
if (!$client) {
    exit("$errstr\n");
}
stream_set_blocking($client, 1);

$sql = "select * from b_users";

fwrite($client, json_encode(['sql' => $sql], true));

echo fread($client, 8192), "\n";